
//继承

class Animals{
    public String name;
    public int age;
    public String color;


    public void eat() {
        System.out.println(this.name + "在吃东西");
    }
}

class Dog extends Animals{
//    public String name;
//    public int age;
//    public String color;
//
//
//    public void eat() {
//        System.out.println(this.name + "在吃东西");
//    }
    public void run() {
        System.out.println(this.name + "在跑");
    }
}

class Bird extends Animals{
//    public String name;
//    public int age;
//    public String color;
//
//
//    public void eat() {
//        System.out.println(this.name + "在吃东西");
//    }
    public void fly() {
        System.out.println( this.name + "在飞");
    }
}

public class blog {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.name = "小灰";
        dog.age = 10;
        dog.color = "灰色";
        dog.eat();
        dog.run();

        Bird bird = new Bird();
        bird.name = "小花";
        bird.age = 10;
        bird.color = "花色";
        bird.eat();
        bird.fly();
    }
}
